package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * 使用文件字节流 复制文件
 */
public class FileCopyDemo {
    public static void main(String[] args) throws Exception {
        FileInputStream fis =
                new FileInputStream("C:\\Users\\Administrator\\Desktop\\zly.png");
        FileOutputStream fos =
                new FileOutputStream("C:\\Users\\Administrator\\Desktop\\zly2.png");
        int d;
        long startTime = System.currentTimeMillis();
        while ( (d=fis.read())!=-1 ){
            fos.write(d);
        }
        long endTime = System.currentTimeMillis();
        System.out.println("复制结束用时"+(endTime-startTime)+"ms");
        fis.close();
        fos.close();
    }
}
